<?php 
include("helper/DBOperation.php");
$dbObj = new DBOperation();

include("helper/check_user_login.php");
checkUserIsLogin();


$userId = $cookie['userslog']['id'];
if(isset($_REQUEST['notification_type']) && $_REQUEST['notification_type']!=""){
	$notification_type = $_REQUEST['notification_type']."_alert";
	$status = 1;
	if($_REQUEST['status']=='false'){
		$status = 0;
	}

	$query = "update tbl_users set ".$notification_type." = '".$status."' where id = '".$userId."'";
	if(mysql_query($query)){
		$cookie['userslog'][$notification_type] = $status;
		$message = "Alert has been set.";
	}else{
		$message = "Alert can not be set this time. Try Again";
	}
}

echo $message;


?>
